package server.util;

import javax.servlet.http.HttpServletResponse;

public class ResponseUtil {
    //根据状态码返回对应信息
    public static String getStatusMessage(int status) {
        switch (status) {
            case HttpServletResponse.SC_OK:
                return ("OK");
            case HttpServletResponse.SC_ACCEPTED:
                return ("Accepted");
            case HttpServletResponse.SC_BAD_GATEWAY:
                return ("Bad Gateway");
            case HttpServletResponse.SC_BAD_REQUEST:
                return ("Bad Request");
            case HttpServletResponse.SC_CONFLICT:
                return ("Conflict");
            case HttpServletResponse.SC_CONTINUE:
                return ("Continue");
            case HttpServletResponse.SC_CREATED:
                return ("Created");
            case HttpServletResponse.SC_EXPECTATION_FAILED:
                return ("Expectation Failed");
            case HttpServletResponse.SC_FORBIDDEN:
                return ("Forbidden");
            case HttpServletResponse.SC_GATEWAY_TIMEOUT:
                return ("Gateway Timeout");
            case HttpServletResponse.SC_GONE:
                return ("Gone");
            case HttpServletResponse.SC_HTTP_VERSION_NOT_SUPPORTED:
                return ("HTTP Version Not Supported");
            case HttpServletResponse.SC_INTERNAL_SERVER_ERROR:
                return ("Internal Server Error");
            case HttpServletResponse.SC_LENGTH_REQUIRED:
                return ("Length Required");
            case HttpServletResponse.SC_METHOD_NOT_ALLOWED:
                return ("Method Not Allowed");
            case HttpServletResponse.SC_MOVED_PERMANENTLY:
                return ("Moved Permanently");
            case HttpServletResponse.SC_MOVED_TEMPORARILY:
                return ("Moved Temporarily");
            case HttpServletResponse.SC_MULTIPLE_CHOICES:
                return ("Multiple Choices");
            case HttpServletResponse.SC_NO_CONTENT:
                return ("No Content");
            case HttpServletResponse.SC_NON_AUTHORITATIVE_INFORMATION:
                return ("Non-Authoritative Information");
            case HttpServletResponse.SC_NOT_ACCEPTABLE:
                return ("Not Acceptable");
            case HttpServletResponse.SC_NOT_FOUND:
                return ("Not Found");
            case HttpServletResponse.SC_NOT_IMPLEMENTED:
                return ("Not Implemented");
            case HttpServletResponse.SC_NOT_MODIFIED:
                return ("Not Modified");
            case HttpServletResponse.SC_PARTIAL_CONTENT:
                return ("Partial Content");
            case HttpServletResponse.SC_PAYMENT_REQUIRED:
                return ("Payment Required");
            case HttpServletResponse.SC_PRECONDITION_FAILED:
                return ("Precondition Failed");
            case HttpServletResponse.SC_PROXY_AUTHENTICATION_REQUIRED:
                return ("Proxy Authentication Required");
            case HttpServletResponse.SC_REQUEST_ENTITY_TOO_LARGE:
                return ("Request Entity Too Large");
            case HttpServletResponse.SC_REQUEST_TIMEOUT:
                return ("Request Timeout");
            case HttpServletResponse.SC_REQUEST_URI_TOO_LONG:
                return ("Request URI Too Long");
            case HttpServletResponse.SC_REQUESTED_RANGE_NOT_SATISFIABLE:
                return ("Requested Range Not Satisfiable");
            case HttpServletResponse.SC_RESET_CONTENT:
                return ("Reset Content");
            case HttpServletResponse.SC_SEE_OTHER:
                return ("See Other");
            case HttpServletResponse.SC_SERVICE_UNAVAILABLE:
                return ("Service Unavailable");
            case HttpServletResponse.SC_SWITCHING_PROTOCOLS:
                return ("Switching Protocols");
            case HttpServletResponse.SC_UNAUTHORIZED:
                return ("Unauthorized");
            case HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE:
                return ("Unsupported Media Type");
            case HttpServletResponse.SC_USE_PROXY:
                return ("Use Proxy");
            case 207:       // WebDAV
                return ("Multi-Status");
            case 422:       // WebDAV
                return ("Unprocessable Entity");
            case 423:       // WebDAV
                return ("Locked");
            case 507:       // WebDAV
                return ("Insufficient Storage");
            default:
                return ("HTTP Response Status " + status);
        }

    }
}
